package com.ln.第一遍1105.demo02;

import java.util.stream.Stream;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/5 15:27
 */
public class Test01 {
    public static void main(String[] args) {
        String[] arr1 = { "a", "b", "c", "d" };
        String[] arr2 = { "d", "e", "f", "g" };

        Stream<String> arr11 = Stream.of(arr1);
        Stream<String> arr21 = Stream.of(arr2);

        //合并流--concat
//        Stream.concat(arr11,arr21).forEach(System.out::println);

        //去重--distinct
//        Stream.concat(arr11,arr21).distinct().forEach(t-> System.out.println(t));

        //获取前n个元素--limit
//        Stream.concat(arr11,arr21).distinct().limit(5).forEach(System.out::println);

        //跳过前n个元素--skip
        Stream.concat(arr11,arr21).distinct().skip(5).forEach(System.out::println);
    }
}
